package com.example.jpahibernatedemo.entity;

import lombok.Data;
import org.hibernate.annotations.Columns;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@Data
@Entity
//@Table(name = "address")
@Table(name = "address"
    , indexes = {@Index(name = "idx_uid",  columnList="user_id", unique = true)}
)
@org.hibernate.annotations.Table(appliesTo = "address",comment="用户地址信息")
public class Address implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @Id
    // @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false)
    private Long id;

    /**
     * 用户id
     */
    @Column(name = "user_id", columnDefinition="int(11) COMMENT '用户id'")
    private Long userId;

    /**
     * 地址
     */
    @Column(name = "address")
    private String address;

    /**
     * 年龄
     */
    @Column(name = "create_date")
    private Date createDate;

    /**
     * 邮箱
     */
    @Column(name = "update_date")
    private Date updateDate;

}
